<!DOCTYPE html>
<html lang="en">
<head>
[#include "/customer/include/static.htm"]
    <link href="${path}/resources/css/user.css?v=2" rel="stylesheet" type="text/css"/>
    <link href="${path}/resources/plug/layui/css/layui.css" rel="stylesheet" type="text/css"/>
    <script src="${path}/resources/plug/layui/layui.js" type="text/javascript"></script>
    <style type="text/css">
        option {
            font-size: 14px;
            line-height: 20px;
        }
    </style>

[#import "/customer/include/pagination.ftl" as p/]
</head>

<body>
<!--头部-->
[#include "/customer/include/header.ftl"]


<div class="member">
    <!--左边-->
[#include "/customer/include/member_left_menu.ftl"]

    <!--左边 end-->
    <div class="memberRight">
        <div class="member_tab">
            <div class="member_tab">
                <a  href="${path}/member/auth">实名认证</a>
                <a class="on"  href="${path}/member/auth/mobile">手机认证</a>
                <a   href="${path}/member/auth/email">邮箱认证</a>

                <a  href="${path}/member/auth/vip">VIP认证</a>
            </div>
        </div>
        <form class="layui-form">
            <div class="member_tab_info">
                <table class="layui-table">
                    <tbody>

                    <tr>
                        <td>绑定手机号：</td>
                        <td>
                            <input type="text" disabled="disabled" value="${mobile?substring(0,3)+"****"+mobile?substring(8)}" autocomplete="off"
                                   class="layui-input">
                        </td>
                    </tr>

                    [#--<tr>--]
                        [#--<td>验证码：</td>--]
                        [#--<td>--]
                            [#--<input type="text" name="code1"   placeholder="请输入验证码"--]
                                   [#--autocomplete="off" class="layui-input">--]

                        [#--</td>--]
                        [#--<td>--]
                            [#--<button  id="dd1"  class="sendsms1 layui-btn layui-btn-small"  style="width: 100px;background-color: #f3485a">发送验证码</button>--]
                        [#--</td>--]
                    [#--</tr>--]

                    [#--<tr>--]
                        [#--<td>新手机号：</td>--]
                        [#--<td>--]
                            [#--<input type="text" id="newmobile" name="newmobile"--]
                                   [#--placeholder="请输入新手机号" autocomplete="off" class="layui-input">--]
                        [#--</td>--]
                    [#--</tr>--]

                    [#--<tr>--]
                        [#--<td>验证码：</td>--]
                        [#--<td>--]
                            [#--<input type="text" name="code2" id="code2"--]
                                   [#--placeholder="请输入验证码" autocomplete="off" class="layui-input">--]

                        [#--</td>--]
                        [#--<td>--]
                            [#--<button  id="dd2" class="sendsms2 layui-btn layui-btn-small" style="width: 100px;background-color: #f3485a">发送验证码</button>--]
                        [#--</td>--]
                    [#--</tr>--]
                    </tbody>

                </table>

                [#--<div class="layui-form-item">--]
                    [#--<div class="layui-input-block">--]
                        [#--<button lay-submit lay-filter="MainForm" class="layui-btn"style="width: 100px;background-color: #f3485a">--]
                            [#--确认提交--]
                        [#--</button>--]
                    [#--</div>--]
                [#--</div>--]
                </div>
            </div>
        </form>
    </div>
</div>


<script type="text/javascript">
    layui.use(['form','layer'], function(){
        var form = layui.form(), $=layui.jquery, layer = layui.layer;


    });
    $(function () {
        $('body').attr('style','min-width:500px');

    });

    layui.use(['form','layer'], function () {
        var form = layui.form(), $ = layui.jquery, layer = layui.layer;

        $(".sendsms2").click(function () {
            var newmobile = $.trim($("#newmobile").val());
            if (newmobile == '') {
                layer.msg('新手机不能为空');
                return false;
            }
            var $this = $(this);
            $.ajax({
                type: "post",
                url: "${path}/member/auth/SendSmsAuth?t="+Math.random(),
                data: {
                    "mobile": newmobile,
                    "newMobile": true
                },
                cache:false,
                dataType: "json",
                success: function (res) {
                    layer.msg(res.content);
                    if (res.type == "success") {
                        $this.attr("disabled", true).addClass("layui-btn-disabled");
                        var s = 60;
                        $this.text(s + "秒");
                        var inter = setInterval(function () {
                            s--;
                            $this.text(s + "秒");
                            if (s <= 0) {
                                $this.removeAttr("disabled").removeClass("layui-btn-disabled").text("重新获取验证码");
                                clearInterval(inter);
                            }

                        }, 1000);
                    }

                }
            });

            return false;
        });

        $(".sendsms1").click(function () {
            var $this = $(this);
            $.ajax({
                type: "post",
                url: "${path}/member/auth/SendSmsAuth?t="+Math.random(),
                data: {
                    "newMobile": false
                },
                cache:false,
                dataType: "json",
                success: function (res) {
                    layer.msg(res.content);
                    if (res.type == "success") {
                        $this.attr("disabled", true).addClass("layui-btn-disabled");
                        var s = 60;
                        $this.text(s + "秒");
                        var inter = setInterval(function () {
                            s--;
                            $this.text(s + "秒");
                            if (s <= 0) {
                                $this.removeAttr("disabled").removeClass("layui-btn-disabled").text("重新获取验证码");
                                clearInterval(inter);
                            }
                        }, 1000);
                    }

                }
            });

            return false;
        });

        form.on('submit(MainForm)', function (data) {
            var index = layer.load();
            ajax({
                url: "${path}/member/auth/mobileauth",
                data: data.field,
                success: function (result) {
                    layer.msg(result.content,function(){  location.reload(); });
                    layer.close(index);
                },
                complete: function () {
                    layer.close(index);
                }, error: function () {
                    layer.close(index);
                }

            });
            return false;
        });
    });
</script>
[#include "/customer/include/footer.ftl"]

</body>
</html>
